<?php
header('Content-Type:text/html; charset=UTF-8');

@$login = $_REQUEST['login'];
@$password = $_REQUEST['password'];

require 'lib/db.php';

@$user = dbSelect('select id,password from user where login=:lgn',array('lgn'=>$login));

if(empty($user)){
	die(json_encode(array('status'=>false,'info'=>'登录名不存在')));
}

if($password!=$user['password']){
	die(json_encode(array('status'=>false,'info'=>'密码错误')));
}

session_start();

$_SESSION['userId'] = $user['id'];

echo json_encode(array('status'=>true));